﻿CREATE TABLE [dbo].[WorkOrders] (
    [WorkOrderId] [int] NOT NULL IDENTITY,
    [WorkOrderNo] [nvarchar](max),
    [CustomerId] [int] NOT NULL,
    [EquipmentId] [int] NOT NULL,
    [CalibrationCycle] [nvarchar](max),
    [CalibrationDate] [datetime] NOT NULL,
    [NextDueDate] [datetime] NOT NULL,
    [PONumber] [nvarchar](max),
    [SalesmanId] [nvarchar](128),
    [CreatedBy] [int] NOT NULL,
    [CreatedDate] [datetime],
    [UpdatedDate] [datetime],
    [UpdatedBy] [int] NOT NULL,
    CONSTRAINT [PK_dbo.WorkOrders] PRIMARY KEY ([WorkOrderId])
)
CREATE INDEX [IX_CustomerId] ON [dbo].[WorkOrders]([CustomerId])
CREATE INDEX [IX_SalesmanId] ON [dbo].[WorkOrders]([SalesmanId])
ALTER TABLE [dbo].[Equipment] ADD [WorkOrder_WorkOrderId] [int]
CREATE INDEX [IX_WorkOrder_WorkOrderId] ON [dbo].[Equipment]([WorkOrder_WorkOrderId])
ALTER TABLE [dbo].[Equipment] ADD CONSTRAINT [FK_dbo.Equipment_dbo.WorkOrders_WorkOrder_WorkOrderId] FOREIGN KEY ([WorkOrder_WorkOrderId]) REFERENCES [dbo].[WorkOrders] ([WorkOrderId])
ALTER TABLE [dbo].[WorkOrders] ADD CONSTRAINT [FK_dbo.WorkOrders_dbo.Customers_CustomerId] FOREIGN KEY ([CustomerId]) REFERENCES [dbo].[Customers] ([Id]) ON DELETE CASCADE
ALTER TABLE [dbo].[WorkOrders] ADD CONSTRAINT [FK_dbo.WorkOrders_dbo.AspNetUsers_SalesmanId] FOREIGN KEY ([SalesmanId]) REFERENCES [dbo].[AspNetUsers] ([Id])
INSERT [dbo].[__MigrationHistory]([MigrationId], [ContextKey], [Model], [ProductVersion])
VALUES (N'201405291616003_WorkOrder', N'CaltechSoft.Service.Migrations.Configuration',  0x1F8B0800000000000400ED5DDD6EDC3A92BE5F60DFA1D157BB838CDB76E60499C09E8163277B8CCD8F8FEDCC2CF6C69025DA16A296FA486A8F8DC53ED95EEC23ED2B2CA93FFE152952A2D8EDA41120708BE4C722592C168B55E4FFFDCFFF1EFDF56999CC1E515EC4597A3C3FD8DB9FCF501A66519CDE1FCFD7E5DD1FDFCEFFFA977FFEA7A30FD1F269F6B736DF6B920F974C8BE3F94359AEDE2D1645F8809641B1B78CC33C2BB2BB722FCC968B20CA1687FBFB7F5E1C1C2C10869863ACD9ECE8729D96F112553FF0CFD32C0DD1AA5C07C9E72C4249D17CC7295715EAEC4BB044C52A08D1F1FC34484A143E5C911AAE50FE188768EF03462B9F3FFE7D0F0395E8A99CCF4E9238C0B45DA1E46E3E0BD2342B831253FEEE5B81AECA3C4BEFAF56F843905C3FAF10CE771724056A5AF48E66376DDCFE2169DC82166CA1C27551664B4BC083D74D6F2DC4E283FA7CDEF526EECFBAA748ABAB3EC5DD89F232BE8BC3A04467A80CE2A498CFC46ADF9D263929D2D3F9F51F7B32E2AB1950EE55C74D98E9C83F9C6B9D94EB1C1DA7685DE641F26A76B1BE4DE2F0DFD1F375F61DA5C7E93A49D8D6E0F6E034EE03FE7491672B4CC2F325BA53B6F13C9ACF163CD24284EA80B42875BF9CA7E5EBC3F9EC0B2630B84D50C7504C1F5E95598EFE0DA528C700D145509628C7FC701EA1AADB247AD4B5F7576B0C7555066914E49135E497E031BEAF1AA6069FCF2E5152E5291EE2553D1959EEB88178EF639E2D2FB384470272DE5C07F93DC233FD3A33CA7E95ADF370583BDA4EEA6B4F9BCFBC5D9A12BAF6E98A41ED3C5AD0696F2A0C1C4A812D9AFE23E7FD8626FC97ACAD16AF5D78619ECF3E074F9F507A5F3E1CCFF19F98BBE22714B55F1A52BEA5315EC771A1325FF7CA84BF67F9F7AF7984720F759D568C85F2B172ECC3EFEB78B5C4BD395A206669149331BB44218A1F11230EA7EB045A2766FAD44B9DD768B922DC8827D9E475D5A2F211FDBA5EC651C5EE53776890C4B77935F54E9FC364FA1632159E5502B3AE8FFC7D8D755B6B2EFC8215D7B3357282D5080F14BD9FBEE3AFB164C7F9E3209DBCAADFF00E01F3D2795AAC5088C5EBE4157E0ED2F55D109219337D6567A808F378552BFA53378CECB3BEAC97B71EDA85577CBCD3F254D9C5575F15E55988221FA2F4A42850E9A95597783F997F2FA6179E39225A11154F0357EE1A069699FAA2DF56D1C8A2D6C49B6C36BA0DC3947BA7769360B8776AB72263F7147423E56C6FD1426ED11E83DD538FD86B986FCDDDED39DA3A3D6C02BCAEAC3FEC6AE74A5FBC464579895659EE6B9DD9C9FF71F2DFADAD49B31E9898A886AD0B8D1560F462D0E06C7A051822EE7DCA76F2FFF4AA6A14E5A8985E7DBC46898745E336F66146C8D212AF8317984FB3D4CB207D58E2D93B792D1F09CAC475684D26BB05C87C01EA4CA9F0C2D325DF50A94D171939553ABC00B28C3AA8E8F0C6AE1E1DD06EF9D8227D7D6709DB59C2A09A7C5AC27ACDFB932D4D5E9400E521DC6ED9B4D8B775ABA18B4553DC8569D6D5418BE66FEBAC44E7255A8E5D343BA0DDA2D97B5ED5E41B3359F0BC2E2FF238440CCC9B3F6DEEB8BC1EFEB167EE3B41028D0D2849BAF976C3E4A3A20448966409940712263A222B0C35813704BE9008AB3F4B3B02366DD456A0A1CA8144DB493383793F64BA345D79FA4078A01827C5AEA959611840D50A5F3A64B65C05E9F35859791524A8C0BCAD75113A387CBBB3CBBBD6EFEAF1D3C8BC2E8728F59A04581077A9B622B811B1C344304C0A2F9E4D09695952430BCD2292D3A62828EA924769BBDF8AF1670B04E365AF0A230485F511A2079B729C17A597EDF1A7C05345EFE324C1C8BE0E4E9AEA2EBEBECFA637CF3795FD67BC3AC5657C5577EAC3DBB4AD2B5BA7653E7D75E7C5194A105EDBDA9ADE67586012D96ABB09EC39FB39FCE58DAB13A6D32CBD8BF3E5789A2F82A2F8479647BF06C58307136DB8CE31075D95C17235BDE9F4214B7D29A34C5DCE86E6FA1FD9C78078E27E4849A9D1789FB2F07BB62E3FA495FEF7AD0C6D55C00EC0093927618885F247CCCC28AAA6FA48430E56277A1615D3F9375CA54D8258A14212F26EDA74AAB3319F25858D4DB355213F65F771AAA1A44D1728A93FC3943469B69410040D214DB24047F51526A34E1AA5BDB67B728257F5AF4E95FDDC857F9E14AB2FA8DC6B4BB70A6D8E31B104FDBE27C1BE9A1917A63AEFA1A9CEFBFAE0F6EEF5DB5FDE04D1EB377F42AF7FF911AD22A42B37A16F57C3472A9DDE8A416AFA5B90AC5D573568365473DCFD6CA860B77F365464E2CF8F71445486457F8936338637CADFF2B3ED9C1328F33D1DB866FAAEDC8F0C18345DC85AE47EB610D4ED9F2C302B835949838670FDA6A47F4BEF96719C7B6E7B199CF6528C749BDE7D90E9026BDAEC78DF34D9A8C62DA74A9A37906594067E8DF2D18E120463D3F66342C310F66CCBF9D2A3497D5E2CAE3E9D0B39B78D3314C6CB2099CF2E72FC5773E1129EE65761407AB4D7F7EABCA858A278B0356C18F37C770BC458C6EF8036CDFD1D2143A60057D8D73CF8B96FE2D85DE2B00107DE9D7FC116FA17747200F2319012257548CE616B15ED8909A115B019211269BA864A2693535F045A03E48F20A76A481CE49770521459185754B5838EB451FC7CA33FA4D1CC2EA4BF9EBF42B8289EC978818D577849C534E2C93C1797CEAF697DC2383B09EB8B0A4F83220C229999713BA38134763E80208D5DF82A4FEA1F240AF0EA8E72B29806E48CB1C0FA429C96B22A10A761BC0A12ABEE13504095427B9D18E9A0AE6A31E50CAD504AD400ABEE72425357B530987D7D79B46018D898AF75D1C906BC6314AA0CF210BD61C237BF1B5DE5B759BE37E8564B5E535F7531741E1874A3531A3DCC0B200E44C54FBAA010CA3B8C13781FCB68A121B6EC225578E4FDBDBD0337FCA8A6C3645C47329ABA7F8D988AD92D6D8493A03800D5786B8302E880333141E6BCA40B2630E153A7D27810176A5AE0810D356363523BB7DBDE1C2376FB122D9BC81B1481F9AC194FDAD018C8AF2DE13891745FBC260E8291B4A3B10B1BE4B1DAA15DCF0F82777B0F7F4DA40A82B14E83E4EC08F6E27AC21B73718D36A9B50B20DC0863B16E6EAAD1047DDEE868D6B1055EF80AF2B0632801FCC426E12FA0433CF017D078935A95E7FEDED8ABF15DD40EAAE8C8B839F612DC2615ECD5385E4DC75E7C87F8622FBEF12F83BD6A8F54ED980AEEA99B632EDE1956C15BB5DFC874ACC5F5862FCEE25ABEF58C2504EDE9F51CD95A3E5AAB97ACEB3D3CEBCE2401D7EF4D7D12FBD2A462F6C46E23DC02B8EBA88657E7BB234B0348124C249E341E43FEC594BA973C30A2BA274C2A877D273D31A27C4CAA1A6ECD99291D6DC603C65C80A9CF5A5F84694249BE07CE530ECA8B30C88267E0FD5C021D881BB020B8E2F5E0DB986505161FD40FBDFA83EEC4DDD934DC9C2EA1A6C1EB647A013A45ED2E51DD7E1BA728A7FE58C45BB07BC7517243C4C3D77822168DC791C80E04F60A95F24960738E4862F9A8AF86E63C56623425720FA20D547B5CD903490FBAFBA01B1909E2754B520F08EBE123A130F2A4078631824A284C9A090A4448B3F1E829DEF8964BA56BB9D0535832B74148804DCE02B60D7BD5C236B6180BD82688558B5AABB73DA07D404620C4D91B02A99DEE7B0A77620E4260560E01869143E0CC03AFD2670A993DC2220A4E6B07AEAEB5A2849164B2B5DF150CCD884551BFE4BBCCAE3BB52F1468BBD5D87B48D50726FE43705F30D2D7ACBB4DDC7EA6EF76E8AA51B98BFB1C51B8366A5C5198F6B00B83A6C334CE276CE7D0A56A748F805726CA5DD2EB51211BAA143E154C3B944B592F18D029EA1E1EDA2BD49F58D11FF04E1A30D989FB68B10FF44C011FE64FC90FEDF568AA760387CD00C5FC71F39036F3A7C4269C33A0C5DC6D1E728B95A7A0B2055F380765E86D74294D83A1E34B0600D2A7DCB4BC55A3142D870EE87A8FE8EC5B2E9CAC295ADED2EAA6E58D82A668387074D4777864DF6CFECC47D1EA864E47539B7AF7AB66376C9A3039DC1832C72513445F2F0E683914332BB7BECF546F6AAC671A000E9DA96D7D627600E266E43EE9B11A1BDA8D9996B07B124DB7A82DC513AD7B70948EAE4354964C735BE6986E014C97532943506490AE630CE487C6B839A6535CCA92364EA933BC7569478BABF0012D83E6C3D1026709D1AA5C0749F5464AD1267C0E56AB38BD2F68C9E6CBEC6A1584647FF4C7ABF9EC6999A4C5F1FCA12C57EF168BA2822EF696DD450E61B65C0451B638DCDFFFF3E2E060B1AC311621C777A299B0ABA9CCF2E01E09A9C46B3142D52DA1674119DC062418EF345ACAD97833A3C2DED056A6B124CAC3D7DA23DAC2E46FCEB609074E37A4408648D978DB607FC45D406643D51B48BBCD9441300C093C0F723126512A4B0CC2A759B25EA6BA1C22271BD5A0811E8CC9067C28B075312184F385FE958CE1D2284BE7723C07D9F2D7B47C358EA10671D214E34CE2E3159824C91C938BB86711B9040B1A9963498E40CD71A51A8DF3F667E1B461001AEAB2348AC9BA708942143F22799E401906E197EB3CD5E2D30CE6F8D768B922572B54EF4DB1B85C82395E1D33FC887E5D2FE3A8BA9F810595532D7A42BACC80EB06297510721DC7AE003E030E9F74B8DCED052C2697603D5BEB907960AED60936631F3EA431D66B5271E8E97773B4DFB0668387F43C2D5688DC61CB63CAA9E6C8FC63792C2A9F628EC85D5AC30272091614B2AFDE7104B209E678FCCB762C209F628E486FBF60D1E8570B24FA3E1D07453F9B63712FD0B1685C828DF45906F9F742143ACD478B9946EFD5E0E619FD6C8D05481636C11C8FBB7183C5E312ACF1C4B6329FB751A7A3474B53EA769D5FC0281D4F8DE243FF56CA98A694A8A6B1DF3729A3B75FA6826BFB8075FD1A15E5255A6539280AE5D49D1C7BE972AC3349BA175E8AB3681389A52CAAEA725126D90920F2BFA01707F2AD513A84EE99174E75683FDA4CC0449C73899DA8AADFB6E7A554FDCD6AAB273E5D2F6CF4C4648B6D6FFD5009B7E1AD3F9963544FD0B308D5870D6E8776C26D1B859BF6C463A47453BA951888374DD969E4DB6EDBBADBB69AE1BD1403D4F815DBAD3177B7026CE50A40FDAE9C2F004A6883054053769A0580BE572E584253E8E662EDE0D337CBB9C1A79F377702D25D3FC237527127891A673799B777324FA0CAD5E1250367B1BF19DCBDD12D71B7ED988BCF760BEA119766B175153765D7769B32EEFD6EA98D0354197ACF15BF79555E7FA5E93126848EEB2D4D689D86B29D7CD946F9A272A11C295EAAF8337BE902179B46B88CB53A31CF37735619FAD91C8B3ED0CC42D1AFE648E20BCC2C9E98668DDA3CB40C603629D688DD6BCA006697668D7A2A697D5C823D5EFB303204D9A699A332EF1F73EC4B3FFBB52C8A0F1C4B604C9AC58E9F7BE898DBF47329364B38F79A31BF8273491654B26F167344B20983F0143D0AE7B0905BD22BC59C1093522DA490FC5E31278EE4E401D800CD629A8525487ED298B307C9C9168B78F7BE31B786775FB7660907C28E9CAFE77214B8FDE26E8031CD4ADFDE44268EA3A5024B9FA8E5544EFAD912AB798456026BBE6F257F2923CD1CF2577D1DC038FE5260A8A513F7DC2B2F9CB46FD4AA312FD8375C059BB7FA0D5B359E1D176F01AFA882F31CB24A753DC3384E8121A61525ED1D639C9B9CE2DEB18D0DE5C4C33772E8EC86CD97A7C48686AABE80C4F95055F797D80F115C4CBD0DAF5FE6E477E2D02B9F7D28F230D1AF9B3BE405CE0DACCF0CB8B732F92D2393B035ECC884043AE7497A238E3D636ACAAA7A9E7B34138CA6B1E3D39F2C3AE7A78F1971E740B1B3C6FF48D6783EA259213EB928F7A17292033176CA2291DB2AD10544C9CBFD37509ADE68E56A75476C8B399062E505968315472D555D7CE0ECBC202FAB76AFAA5A375F0C8397F94A8A8617B3745CDD7CE97E77D1F04D243A17225FF50D0978AFFAA468A2E2C5D0F43A0B790EBCDEDD62C9F45C9468B94732EC5DFD9E9C263161B42EC3E7208DEF5051D64F62CF0FF7F7DFCE6727491C14F565054DD0FD3BF1D24CA328FC83D7240A1F45CB8558DC3E969FA01445C4BDD82DBF36DEFB38A4D10BDF26D1E8FD4F7DC328F5BD82311983DE57BD6D5F30465C0434539374E5E9791AA1A7E3F97F5525DFCDCEFFE3862BFC6A56B1FFBBD9FEECBFC790C106E50C268782589065FC3EBD320CDD9A5546F2883FE6A0AFC0A78F411E3E04F9BF2C83A77F65214DDEDD065E951F8527BF1C5F75C4F877E387C08011EB2E1A0945AA3BC0E522D51DE0C941EA2E1A2FED35DC82B20FB013B5B2AC1E60B71C796E8F31128B8B497732CA3428DD019C1C8FEE0094F7EB7700C8997C5C10C8FAF53BC0E3DDFA1D00D28DA90B30EADBEF008DF3ED7722669AB0741782806E9B47C87D76B7AC9EFD26F4701B652750364D1BA200C131DAD68A903A14DB4A2152288FAE152336D47B1BC5DFD68B2B578BA51CE3BD130A1B130AF0B3F2469260C8B49F788ED7C74F2ED6BFD66BD38932973812107590B59BDD89185EED00B57185748054055B3BC031D4F17702663201A3B079BF5809B3DBF5EC763D53982C3C4B3367325F61CC33B1FC762555E6DE9D581EDF34C56197DD508120E6A366BC582882965FEC6241A39F870F2013F65C83DCC6F72EEDE506C3CF141D7560D4C549DB55DF141B7756B513138327E40F3319BB38E6711D2EC62F8F9A96D774A73310818B5D76B237ECA2972D17F4B6E0A899CA7A58F1AD31228216E7A9F81C3C7D42E97DF9703C3F387CBBD332BC880F39C0D887F4A0FCA21E744343A5236B060D52768046E3941D808941CAEE209B186577805D80B23BC8535707DE6274B20348263EB95D1E06287D90458E9B1787BFBC1964E66382698793C787263B31567081C92E0C0C6C60B25B3C275D2847200FC702428EC7AD2D62A8F170D280D8E2115BAA2EAAD856C1684B569F5FCDCE0BBC3BFB7D8D13AE716F086A8630B3C6ACA33DB1BC2F56256F63F906E8797551531DCF4C3FA3B1C52ED46826B8D81A6E10670051B8669CD113740B94B8D005D502F9E1A0CD7EFE132873ACDF71AD708CBD49D61EC43D7288A719F3A8E27181AC70D06D3F176C9798685B31809ABAA8CF911D3AAA5BB2031BB64A93466F6095962371CDFA1A8EBFEDEFEFB6DC840B340DE9DDC2934ECE2A1EA1305E06090978C17F1555E4CA016638126784930FEDB75F4CACAFA9DE6ACC2A8AD858337ED1462DF5318DEA14C835E7780A1A7072CEE835DEE067738D777ADCBF330EBF58E330134ED93699BA00DFF4C6F3D1B78DD940AE86AAEAB565EEFBE77552C6AB240E31257850A580DBAF696D5D9B9D847594E3695084817CFD61156D6A40494BB482A02E99A7EB0F527558CAA39C88DC8058D88A320F62391A1A2F7C6918AF8204E811212FB880F4BCA07AB4E82A1053CED00AA5644950F7801302BA7A84C1E8EB1E2E6AD798FB5ACFF0815CD879D32B069FA6FFAC5CA979594ECB1CBAB7DEBC72A99E100FDCDA691F370A8F6D66FCDB0CDCA8771FF9B1DEDFDB3B90869B6251EF4D168CF93A0DE7A89FF532D9A95AF186EE911D80253417BD78E183CE43EA46E5583B78F0261247D4A78BA582F93A090BD90DEB481ED2BDD32157A6BDDDC71F13B5EE1A6EE4C894CC2333CE0F2077542F42003247FD9A80476E21ECADD6860CC7E9871231E623E855BC281FA3F1C22CC4DE7E035D8BCC0C57E515C48E54FDC10BABC827A92C2140EA24ACA378AFC139E798DC236D71A2E38D81A07B8FB79081EA0357150335A93F0C03A92E8ADE4606026ED3DD42FEA90EE754EC5327FE30DCA3B88078CB98A7D6755A33F13806EAD95AFB556D7D0DB9B952A4BB49D3CB58B347E437C0C34CC0A4554E5868B2FEC002A4E756F1ED1024AA2BDEBD30178D987B09DB6C7A1CCD12C17C7DF1DB6DDD45D65B68E603EF9375347A5B69F2B51B9F9E6B6B2732FE1A5F9BEB9541BC282B9B1110BE94163BE6F3ACB87CE02F19EE8C82C285C0D2F037B74ECB6759DDA91F3DA7D71C0DD6170D1FCFA35BE2C7539FFA43F924D651D6AFAFB8B7469BAAE8C9ABAE4A9AABA76A9AB18F846EF996EBED92C0CA9AD4FE0E6504B25407930655C224F754C29850A54A9834A8922EB9BF29CDBE07AE4183DE8F5C4B3A09B8FE0CE19E14AB2FA8AC37037DE080B150AA09C8A3AFB6319DDAD4DDD899B4753779F4753756379BBAEB3D86B6EA3A8BBEE6DA5C635A714FA57D159A555639F3CA95D49F21F03AA5079559312568260DC2679E79116BE16FAA37F3AE9A31856491D8EB09C36F6164E15EBD77A091DAAAF2C2E224C2A8961BE1B27EBBEED1B9FFE8BBC9D87148D55C718112DBAB5A7136DE7D803F0AD0557D5E2B8A8D304B7CF751D301D25A28BCB631BEB990DB05D0DE5EEF8C3164CBD6437665AECA325FDD34B9B35EA81A0B9B371C8D2BA718D0063A6B5CA39EA89A061C790F21CFF3B8B127B040D39407B4C09E91A1B0FEA06998521B523C46EBA8A1ADCEA268A8F20155370DE5542FC5ABA88E1ADA682D8A76AA5E8F74D34C56E1825FF47435233B63867252C2E68E918D9D4ED000870C40D3FA8E22348711C0A84023B2D1B1958DE1401FF458CC1D2D2992022E3C55E8B2B1EC5360BAF6AA4CBC6308F7AC1F01E6486D932799C5EEC6567ADAAB4B3B5AD47BB3E603FE293DE175B4B85CA724D8A6FE75868AF89E429027CA52147256BE2ECF797A97B5064781A2368B10A0F3196BF45150062744C727373A93FB508B224EEFE7B3EAF201725DCB2D8ACED3AFEB72B52EC90DA7CBDB848BDA27464B5DFD470B89E6A3AF551867E1A20998CC9844197D4DDFAFE324EAE8FE08C41629208835B4895D2463599218C6FBE70EE94B961A0235DDD71971C96B3B09062BBEA657C1231A421B66DB4FE83E089FE935062A90FE81E0BBFDE82C0EEEF360593418B43CFE8979385A3EFDE5FF014DA4B29FA8330100 , N'6.1.0-30225')

